package com.github.chain.admin.client;

import com.github.chain.admin.common.domain.Menu;
import com.github.chain.admin.common.request.MenuRequest;
import com.github.framework.core.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
 * @author AIQ
 * @date 2023/5/11
 * @project er-trader
 */
@FeignClient(value = "admin-server")
@RestController
public interface MenuServiceClient {

    @GetMapping("/findMenuByUserId/{userId}")
    Result<TreeMap<Long, Menu>> findMenuByUserId(@PathVariable("userId") Long userId);

    @PostMapping("/roleMenuAuthList/{id}")
    Result<List<Menu>> roleMenuAuthList(@PathVariable("id") Long id);

    @PostMapping("/findMenuList")
    Result<List<Menu>> findMenuList(@RequestBody MenuRequest menuRequest);

    @PostMapping("/findMenuListSort")
    Result<Map<Integer, String>> findMenuListSort(@RequestBody MenuRequest menuRequest);

    @PostMapping("/findMenuById/{id}")
    Result<Menu> findMenuById(@PathVariable("id") Long id);

    @PostMapping("/saveMenu")
    Result saveMenu(@RequestBody MenuRequest menuRequest);

    @PostMapping("/findMenuByMenuId/{id}")
    Result<Menu> findMenuByMenuId(@PathVariable("id") Long id);

    @PostMapping("/updateMenu")
    Result<Integer> updateMenu(@RequestBody MenuRequest menuRequest);

    @PostMapping("/deleteMenuByMenuId/{id}")
    Result<Integer> deleteMenuByMenuId(@PathVariable("id") Long id);
}
